<template>
	<view class="content">
		<view class="header">
			<view class="tabs">
				<view class="item font28" :class="tabsIndex == index?'bg':''" v-for="(item,index) in tabsList"
					@click="tabs(index)">
					{{item.name}}
				</view>
			</view>
			<view class="timeBox">
				<view class="starTime font28" @click="starOpen">
					{{starTime}}
				</view>
				<view class="heng">
					-
				</view>
				<view class="endTime font28" @click="endOpen">
					{{endTime}}
				</view>
			</view>
		</view>
		<view class="box">
			<view class="item" v-for="(item,index) in profitList" :key="index">
				<view class="icon">
					<image :src="item.icon" mode="aspectFit"></image>
				</view>
				<view class="title font28">
					{{item.name}}
				</view>
				<view class="number font30">
					{{item.number}}
				</view>
			</view>
		</view>
		<yt-dateTimePicker ref="starShow" @submit="starTimes" :start-year="2000" :end-year="2099" time-init="2023-5-20"
			:time-hide="[true, true, true, true, true, true]" :time-label="['年', '月', '日', '时', '分', '秒']" />
		<yt-dateTimePicker ref="endShow" @submit="endTimes" :start-year="2000" :end-year="2099" time-init="2023-5-20"
			:time-hide="[true, true, true, true, true, true]" :time-label="['年', '月', '日', '时', '分', '秒']" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabsList: [
					{ name: '今日' },
					{ name: '昨日' },
					{ name: '本月' },
					{ name: '上月' }
				],
				scrollTop: 0,
				tabsIndex: 0,
				starTime: '', //开始时间
				endTime: '', // 结束时间
				profitList: [{





					icon: '../../../static/images/shopowner/zongyingye.png',
					name: '总营业额',
					number: '0'
				}, {
					icon: '../../../static/images/shopowner/xianjin.png',
					name: '现金营业额',
					number: '0'
				}, {
					icon: '../../../static/images/shopowner/feixianjin.png',
					name: '非现金营业额',
					number: '0'
				}, {
					icon: '../../../static/images/shopowner/kaika.png',
					name: '开卡充值',
					number: '0'
				}, {
					icon: '../../../static/images/shopowner/vip1.png',
					name: '会员开卡',
					number: '0'
				}, {
					icon: '../../../static/images/shopowner/xuchong.png',
					name: '会员续充',
					number: '0'
				}, {
					icon: '../../../static/images/shopowner/xiangmu.png',
					name: '项目收入',
					number: '0'
				}, {
					icon: '../../../static/images/shopowner/xinzeng.png',
					name: '新增会员',
					number: '0'
				}, {
					icon: '../../../static/images/shopowner/ticheng.png',





					icon: '/shopowner/static/images/zongyingye.png',
					name: '总营业额',
					number: '0'
				}, {
					icon: '/shopowner/static/images/xianjin.png',
					name: '现金营业额',
					number: '0'
				}, {
					icon: '/shopowner/static/images/feixianjin.png',
					name: '非现金营业额',
					number: '0'
				}, {
					icon: '/shopowner/static/images/kaika.png',
					name: '开卡充值',
					number: '0'
				}, {
					icon: '/shopowner/static/images/vip1.png',
					name: '会员开卡',
					number: '0'
				}, {
					icon: '/shopowner/static/images/xuchong.png',
					name: '会员续充',
					number: '0'
				}, {
					icon: '/shopowner/static/images/xiangmu.png',
					name: '项目收入',
					number: '0'
				}, {
					icon: '/shopowner/static/images/xinzeng.png',
					name: '新增会员',
					number: '0'
				}, {
					icon: '/shopowner/static/images/ticheng.png',





					name: '提成合计',
					number: '0'
				}]
			};
		},
		onLoad() {
			this.getCurrentTime()
		},
		methods: {
			getCurrentTime() {
				const now = new Date();
				const year = now.getFullYear();
				const month = String(now.getMonth() + 1).padStart(2, '0');
				const day = String(now.getDate()).padStart(2, '0');
				const hours = String(now.getHours()).padStart(2, '0');
				const minutes = String(now.getMinutes()).padStart(2, '0');
				const seconds = String(now.getSeconds()).padStart(2, '0');
				this.starTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
				this.endTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
			},
			tabs(index) {
				this.tabsIndex = index
			},
			starOpen() {
				this.$refs.starShow.show();
			},
			endOpen() {
				this.$refs.endShow.show();
			},
			starClose() {
				this.$refs.starShow.hide();
			},
			endClose() {
				this.$refs.endShow.hide();
			},
			// 开始时间
			starTimes(e) {
				this.starTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}:${e.second}`;
			},
			// 结束时间
			endTimes(e) {
				this.endTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}:${e.second}`;
			}
		}
	}
</script>

<style lang="scss">
	.content {
		padding: 29rpx 33rpx;

		.header {
			margin-bottom: 16rpx;

			.tabs {
				background: #E6F9EF;
				border-radius: 60rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;

				.bg {
					background: #1EB481;
					border-radius: 60rpx;
					color: #fff !important;
				}

				.item {
					width: 25%;
					color: #1EB481;
					text-align: center;
					padding: 20rpx 0;
					transition: 0.3s linear;
				}
			}

			.timeBox {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 32rpx 21rpx;
				background-color: #fff;
				margin-top: 18rpx;

				.starTime {
					color: #333333;
				}

				.heng {}

				.endTime {
					color: #333333;
				}
			}
		}

		.box {
			display: grid;
			grid-template-columns: 1fr 1fr 1fr;
			background-color: #fff;
			margin-top: 18rpx;

			.item {
				margin-bottom: 73rpx;

				.icon {
					width: 42rpx;
					height: 42rpx;
					margin-bottom: 43rpx;

					image {
						width: 42rpx;
						height: 42rpx;
					}
				}

				.title {
					color: #333333;
					margin-bottom: 18rpx;
				}

				.number {
					color: #1EB481;
				}
			}
		}
	}
</style>